package com.ecreditpal.audio.netty.config;

import com.netflix.appinfo.EurekaInstanceConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;


@Configuration
@EnableConfigurationProperties
//@ConditionalOnBean(EurekaInstanceConfig.class)
public class NettyMetedataEurekaConfiguration {

    public static final String name = "nettyServer";

    @Autowired
    private EurekaInstanceConfig instance;

    @Autowired
    private NettyServerProperties nettyProperties;

    @PostConstruct
    public void init() {
        this.instance.getMetadataMap().put(name, String.valueOf(nettyProperties.getPort()));
    }

}